package com.linkhub.oms.admin.modules.user.accountflow.service;

import com.linkhub.oms.admin.modules.user.accountflow.domain.dto.UserAccountFlowDTO;
import com.linkhub.oms.admin.modules.user.accountflow.domain.param.UserAccountFlowQueryParam;
import com.linkhub.oms.admin.modules.user.accountflow.domain.vo.UserAccountFlowSimpleVO;
import com.linkhub.oms.admin.modules.user.accountflow.domain.vo.UserAccountFlowVO;
import com.linkhub.oms.admin.modules.user.domain.param.BasePageParam;
import com.linkhub.oms.common.enums.mp.DocumentTypeEnum;
import com.linkhub.oms.common.enums.mp.ExpenseTypeEnum;
import com.linkhub.oms.common.enums.mp.TransactionTypeEnum;
import com.linkhub.oms.common.response.PageDTO;
import com.linkhub.oms.entity.UserAccountFlowEntity;
import com.baomidou.mybatisplus.extension.service.IService;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户资金流水 服务类
 * </p>
 *
 * @author Frank
 * @since 2024-05-26
 */
public interface IUserAccountFlowBizService extends IService<UserAccountFlowEntity> {

    /**
     * 生成资金流水
     * @param userAccountFlowDTO userAccountFlowDTO
     */
    void saveAccountFlow(UserAccountFlowDTO userAccountFlowDTO);

    /**
     * 资金流水列表
     * @param userAccountFlowQueryParam userAccountFlowQueryParam
     * @return PageDTO<UserAccountFlowVO>
     */
    PageDTO<UserAccountFlowVO> getAccountFlowPage(UserAccountFlowQueryParam userAccountFlowQueryParam);

    /**
     * 冻结金额列表
     * @param pageParam pageParam
     * @return PageDTO<UserAccountFlowSimpleVO>
     */
    PageDTO<UserAccountFlowSimpleVO> getFreezeFlowPage(BasePageParam pageParam);


    List<UserAccountFlowEntity> queryAccountFlow(String documentId,
                                                 TransactionTypeEnum transactionType,
                                                 DocumentTypeEnum documentType);

    /**
     * 解冻并生成流水
     * @param documentId
     * @param documentTypeEnum
     */
    void unfreezeAccountFlowByDocumentId(String documentId, DocumentTypeEnum documentTypeEnum);

    /**
     * 解冻并生成流水,并直接支付解冻的金额
     * @param documentId
     * @param documentTypeEnum
     */
    void unfreezeAccountFlowAndPayByDocumentId(String documentId, DocumentTypeEnum documentTypeEnum);

    /**
     * 解冻并生成流水,并支付实际要支付的金额
     * @param documentId
     * @param documentTypeEnum
     * @param realPayMap
     */
    void unfreezeAccountFlowAndPayByDocumentId(String documentId, DocumentTypeEnum documentTypeEnum, Map<ExpenseTypeEnum, BigDecimal> realPayMap);

    /**
     * 运费退款
     * @param documentId
     */
    void refundOrderAccountFlowByDocumentId(String documentId);
}
